# 使用alpine基础镜像
FROM node:alpine AS builder

WORKDIR /app

COPY package.json .

RUN npm config set registry https://registry.npmmirror.com/

RUN npm install

COPY . .

RUN npm run build

FROM node:alpine AS runner

COPY --from=builder /app/dist /app
COPY --from=builder /app/package.json /app/package.json

WORKDIR /app

RUN npm config set registry https://registry.npmmirror.com/

RUN npm install --omit=dev

EXPOSE 3000

CMD [ "node", "main.js" ]
